package link.gpt.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import link.gpt.dao.WorkOrderDao;
import link.gpt.pojo.WorkOrder;
import link.gpt.service.WorkOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @version V1.0A
 * @uthor gpt
 * @Project holiday_task
 * @Package link.gpt.service.impl
 * @Description: ${TODO}
 * @Date 2021/10/5 16:13
 */
@Service
public class WorkOrderServiceImpl implements WorkOrderService {

   @Autowired
   private WorkOrderDao workOrderDao;

   @Override
   public PageInfo<WorkOrder> selectAllByProjectIdAndPage(Integer projectId, int num, int size) {
      PageHelper.startPage(num, size);
      List<WorkOrder> workOrderList = workOrderDao.selectAllByProjectIdAndPage(projectId);
      return new PageInfo<>(workOrderList);
   }

   @Override
   public int insertWorkOrder(WorkOrder workOrder) {
      return workOrderDao.insertSelective(workOrder);
   }
}
